package cn.com.tiptop.util.authorize;

import cn.com.tiptop.comon.Code;
import cn.com.tiptop.comon.model.AuthorizeModel;

/**
 * 授权工具
 * @author qing
 *
 */
public class AuthorizeUtil {
	
	/**
	 * 检查授权
	 * @return
	 */
	public static AuthorizeModel checkAuthorize() {
		//是否已授权
		if(getAuthorize()) {
			return new AuthorizeModel(Code.AUTHORIZE_UNAUTHORIZED,Code.getMsg(Code.AUTHORIZE_UNAUTHORIZED));
		}
		//授权未生效
		if(getAuthorizeEffie()) {
			return new AuthorizeModel(Code.AUTHORIZE_INEFFECTIVE,Code.getMsg(Code.AUTHORIZE_INEFFECTIVE));
		}
		//授权过期
		if(getAuthorizeTimeOut()) {
			return new AuthorizeModel(Code.AUTHORIZE_TIMEOUT,Code.getMsg(Code.AUTHORIZE_TIMEOUT));
		}
		return new AuthorizeModel(0,"");
	}
	
	private static boolean getAuthorize() {
		return true;
	}
	
	private static boolean getAuthorizeTimeOut() {
		return true;
	}
	
	private static boolean getAuthorizeEffie() {
		return true;
	}
	
}
